import os
import sys
from typing import Optional


import PySide6.QtGui
import PySide6.QtWidgets
from PySide6.QtCore import Qt, Signal
from PySide6.QtWidgets import QMdiArea, QMdiSubWindow, QPushButton

from ....PSData import *


class DropableMdiArea(QMdiArea, PSDataServer):
    # SigSendDropEvent = Signal(PySide6.QtGui.QDropEvent)
    def __init__(self, parent: Optional[PySide6.QtWidgets.QWidget] = ...) -> None:
        super().__init__(parent=parent)
        self.setAcceptDrops(True)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)

    def dragEnterEvent(self, arg__1: PySide6.QtGui.QDragEnterEvent) -> None:
        if (arg__1.mimeData().hasText()):
            arg__1.acceptProposedAction()
    
    # def dropEvent(self, arg__1: PySide6.QtGui.QDropEvent) -> None:
    #     print('dropEvent')
    #     self.SigSendDropEvent.emit(arg__1)

